    <?php
        $groups=$viewModel->get('groups');
     ?>
     <div class="container-fluid">
			<div class="span10 offset1">
				<div class="row col-md-offset-2" style="color:green;padding-bottom:20px;">
	    			<h3><b>THÊM NGƯỜI DÙNG MỚI</b></h3>
	    		</div>
    			<form id ="registrationForm" class="form-horizontal" enctype="multipart/form-data" action="" method="post">
    				<div class="form-group">
	    				<label class="control-label col-md-2" for="TaiKhoan">Tên tài khoản (*)</label>
	    				<div class="col-md-4">
						<input type="text" class="form-control" name="TaiKhoan" id="TaiKhoan">
						</div>
    				</div>

    				<div class="form-group">
	    				<label class="control-label col-md-2" for="MatKhau">Mật khẩu (*)</label>
	    				<div class="col-md-4">
						<input type="password" class="form-control" name="MatKhau" id="MatKhau">
						</div>
    				</div>

    				<div class="form-group">
	    				<label class="control-label col-md-2" for="retypepass">Nhập lại mật khẩu (*)</label>
	    				<div class="col-md-4">
						<input type="password" class="form-control" name="NhapLaiMatKhau" id="retypepass">
						</div>
    				</div>

    				<div class="form-group">
	    				<label class="control-label col-md-2" for="name">Họ và tên (*)</label>
	    				<div class="col-md-4">
						<input type="text" class="form-control" name="TenNguoiDung" id="name">
						</div>
    				</div>
    				
    				<div class="form-group">
	    				<label class="control-label col-md-2" for="email">Email (*)</label>
	    				<div class="col-md-4">
						<input type="email" class="form-control" name="Email" id="email">
						</div>
    				</div>
    				<div class="form-group">
    					<label class="control-label col-md-2" for="email">Gửi thông tin tài khoản</label>
						<div class="checkbox col-md-4">
							<label>
							    <input type="checkbox" id="email" checked name="GuiEmail" value="1"> Gửi thông tin tài khoản đến Email người dùng
							</label>
						</div>
    				</div>
    				<div class="form-group">
	    				<label class="control-label col-md-2" for="group">Thuộc nhóm</label>
	    				<div class="col-md-4">
	    					<div class="panel panel-default">
                        <div class="panel-heading">Chọn nhóm quyền</div>
                        <div class="panel-body" style="overflow-y: auto; height:350px;">
                            <div class="checkbox">
                                <div>
                                    <label>
                                        <input type="checkbox" onClick="toggle(this)" name="select-all" id="select-all" value="">
                                        Tất cả
                                    </label>
                                </div>
                                <div class="child">
                                <?php foreach ($groups as $group) { ?>
                                <div>                           
                                    <label>
                                        <input type="checkbox" name="check_list[]" value="<?php echo $group->Id; ?>">
                                        <?php echo $group->MoTa; ?>
                                    </label>
                                </div>
                                <?php } ?>
                                </div>
                            </div>
                        </div>
                    </div>
							<!-- <select class="form-control input-sm" name="IdNhom">
                            <?php foreach ($groups as $group) {
                                # code...
                            ?>
		                        <option value="<?php echo $group->Id;?>"><?php echo $group->MoTa; ?></option>
                                <?php } ?>
		                    </select> -->
						</div>
    				</div>
    				<div class="form-group">
    					<div class="col-md-2"></div>
    					<div class="col-md-4">
    					<button type="submit" class="btn btn-success btn-large">Xác nhận thêm người dùng</button>
    					</div>
    				</div>
				</form>
			</div>
	</div>
	<script type="text/javascript">
   function toggle(source) {
    checkboxes = document.getElementsByName('check_list[]');
    for(var i=0, n=checkboxes.length;i<n;i++) {
        checkboxes[i].checked = source.checked;
  }
}
$(document).ready(function() {
    $('#registrationForm').bootstrapValidator({
        // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            TaiKhoan: {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9]+$/,
                        message: 'The username can only consist of alphabetical and number'
                    },
                    different: {
                        field: 'MatKhau',
                        message: 'The username and password cannot be the same as each other'
                    }
                }
            },
            MatKhau: {
                validators: {
                    notEmpty: {
                        message: 'The password is required and cannot be empty'
                    },
                    different: {
                        field: 'TaiKhoan',
                        message: 'The password cannot be the same as username'
                    },
                    stringLength: {
                        min: 8,
                        message: 'The password must have at least 8 characters'
                    },
                    identical: {
                        field: 'NhapLaiMatKhau',
                        message: 'The password and its confirm are not the same'
                    }
                }
            },
            NhapLaiMatKhau: {
                validators: {
                    notEmpty: {
                        message: 'The password is required and cannot be empty'
                    },
                    different: {
                        field: 'username',
                        message: 'The password cannot be the same as username'
                    },
                    stringLength: {
                        min: 8,
                        message: 'The password must have at least 8 characters'
                    },
                    identical: {
                        field: 'MatKhau',
                        message: 'The password and its confirm are not the same'
                    }
                }
            },
            TenNguoiDung: {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                
                    different: {
                        field: 'MatKhau',
                        message: 'The username and password cannot be the same as each other'
                    }
                }
            },
            Email: {
                validators: {
                    notEmpty: {
                        message: 'The email address is required and cannot be empty'
                    },
                    emailAddress: {
                        message: 'The email address is not a valid'
                    }
                }
            }

        }
    });
});
 </script>
